﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:GraphControlLibrary="clr-namespace:GraphMyCode.Controls">

    <GraphControlLibrary:BooleanToVisibilityConverter x:Key="visibilityConverter" />

    <Style TargetType="GraphControlLibrary:GraphControl">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas Background="#01000000" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GraphControlLibrary:GraphControl">
                    <Grid Background="#01000000"
                          x:Name="OutterGrid">
                        <Grid RenderTransformOrigin=".5,.5">
                            <Canvas x:Name="PART_ParentPanel"
                                    Background="#01000000">
                                <ItemsPresenter />
                                <GraphControlLibrary:SelectionControl x:Name="PART_SelectionControl" />

                                <Border BorderBrush="White"
                                        Canvas.ZIndex="1"
                                        CornerRadius="5"
                                        RenderTransformOrigin=".5,.5"
                                        x:Name="MiniMapBorder"
                                        BorderThickness="0">
                                    <Border.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform x:Name="MiniMapZoomTransform" />
                                            <TranslateTransform x:Name="MiniMapDragTransform" />
                                        </TransformGroup>
                                    </Border.RenderTransform>
                                </Border>
                                <Canvas.Projection>
                                    <PlaneProjection x:Name="PanelProjection" />
                                </Canvas.Projection>
                            </Canvas>

                            <Grid.RenderTransform>
                                <TransformGroup>
                                    <TranslateTransform x:Name="DragTransform" />
                                    <ScaleTransform x:Name="ZoomTransform" />
                                </TransformGroup>
                            </Grid.RenderTransform>
                        </Grid>

                        <Border Style="{StaticResource paneBorder}"
                                HorizontalAlignment="Right"
                                x:Name="MiniMapControl"
                                VerticalAlignment="Bottom"
                                Background="{StaticResource backColor}">
                            <Image x:Name="MiniMapImage"
                                   Canvas.ZIndex="0" />
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="GraphControlLibrary:GraphItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GraphControlLibrary:GraphItem">
                    <Border x:Name="SelectionBorder"
                            Padding="4"
                            BorderThickness="1"
                            CornerRadius="5">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="NodeCommonStates">
                                <VisualState x:Name="NotSelected">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="borderBrush"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#01000000" />
                                        <ColorAnimation Storyboard.TargetName="backgroundBrush"
                                                        Storyboard.TargetProperty="Color"
                                                        To="#01000000" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="borderBrush"
                                                                       Storyboard.TargetProperty="Color">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="Black">
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backgroundBrush"
                                                                       Storyboard.TargetProperty="Color">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="#6672B4FF">

                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>

                            <VisualStateGroup x:Name="NodeHighlightStates">
                                <VisualState x:Name="Highlighted">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectionBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NotHighlighted">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectionBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.2" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>

                            <VisualStateGroup x:Name="MouseOverStates">
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ShadowEffect"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.5"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NormalNode">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ShadowEffect"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:1.5"
                                                         To="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>

                            <VisualStateGroup x:Name="NodeVisibilityStates">
                                <VisualState x:Name="Visible">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectionBorder"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <DoubleAnimation Storyboard.TargetName="SelectionBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.8"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Hidden">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectionBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.4"
                                                         To="0" />

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectionBorder"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.4"
                                                                    Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>

                            <VisualStateGroup x:Name="EdgeStates">
                                <VisualState x:Name="NormalEdge">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ShadowEffect"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:1.5"
                                                         To="0" />

                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NextToMouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ShadowEffect"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.5"
                                                         To="1" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border.BorderBrush>
                            <SolidColorBrush x:Name="borderBrush"
                                             Color="#01000000" />
                        </Border.BorderBrush>
                        <Border.Background>
                            <SolidColorBrush x:Name="backgroundBrush"
                                             Color="#01000000" />
                        </Border.Background>

                        <ContentPresenter x:Name="PART_Content"
                                          Content="{Binding}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="Red"
                                                  BlurRadius="10"
                                                  x:Name="ShadowEffect"
                                                  ShadowDepth="0"
                                                  Direction="0"
                                                  Opacity="0" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
